package com.epoint.mobileoa.bizlogic;

import android.content.Context;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.tools.StringHelp;

/**
 * @author liyc
 * @time 2012-2-4 下午10:25:20
 * @annotation 框架方法
 */
public class FrameMethod {

	public static String getIp(FrameParam fp,Context con){
		try{
			return StringHelp.get2AttMid(fp.getSeamurl(),con.getString(R.string.http),"/"+con.getString(R.string.interfacename)+"/"+con.getString(R.string.interfacepage));
		}catch(Exception e){
			return StringHelp.get2AttMid(StringHelp.getResSeamUrl(con),con.getString(R.string.http),"/"+con.getString(R.string.interfacename)+"/"+con.getString(R.string.interfacepage));
		}
	}

	public static String getUpdateXMLUrl(FrameParam fp,Context con){
		String url = con.getString(R.string.http)+getIp(fp, con)+"/"+con.getString(R.string.interfacename)+"/"+con.getString(R.string.update_foler)+"/"+con.getString(R.string.update_xml);
		return url;
	}
	
	public static String getUpdateAPKUrl(FrameParam fp,Context con,String apkname){
		String url = con.getString(R.string.http)+getIp(fp, con)+"/"+con.getString(R.string.interfacename)+"/"+con.getString(R.string.update_foler)+"/"+apkname;
		return url;
	}

	public static String newIpUrl(Context con,String newip){
		return con.getString(R.string.http)+newip+"/"+con.getString(R.string.interfacename)+"/"+con.getString(R.string.interfacepage);
	}

	public static int versionToInteger(String versionstr){
		try{
			String[] ss = versionstr.split("\\.");
			String sv = "";
			for(String s:ss){
				sv += s;
			}
			return Integer.parseInt(sv);
		}catch(Exception e){
			e.printStackTrace();
			return 0;
		}
	}

	public static void main(String[] args){
		System.out.println(versionToInteger("2.1.3"));
	}
	
	
}
